package com.mql.ganio.ui.activity;

import android.view.View;
import android.widget.ImageButton;

import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.mql.ganio.R;
import com.mql.ganio.ui.base.BaseActivity;
import com.mql.ganio.ui.presenter.GanHuoAtPresenter;
import com.mql.ganio.ui.view.IGanHuoAtView;
import com.youth.banner.Banner;

import butterknife.Bind;

public class GanHuoActivity extends BaseActivity<IGanHuoAtView, GanHuoAtPresenter> implements IGanHuoAtView, XRecyclerView.LoadingListener,View.OnClickListener {


    @Bind(R.id.ibAddMenu)
    ImageButton ibAddMenu;
    @Bind(R.id.xRecyclerView_ganHuo)
    XRecyclerView xRecyclerViewGanHuo;
    int page = 1;

    @Override
    public void initView() {
        ibAddMenu.setVisibility(View.GONE);
        setToolbarTitle("福利");
    }

    @Override
    public void initData() {
        mPresenter.refreshData(page);
    }

    @Override
    public void initListener() {
        mToolbarNavigation.setOnClickListener(this);
        xRecyclerViewGanHuo.setLoadingListener(this);
    }

    @Override
    protected GanHuoAtPresenter createPresenter() {
        return new GanHuoAtPresenter(this);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_gan_huo;
    }


    @Override
    public void onRefresh() {
        page = 1;
        mPresenter.refreshData(page);
    }

    @Override
    public void onLoadMore() {
        page++;
        mPresenter.refreshData(page);
    }

    @Override
    public XRecyclerView getXRecyclerView() {
        return xRecyclerViewGanHuo;
    }

    @Override
    public Banner getBanner() {
        return null;
    }

    @Override
    public void onClick(View v) {
        mPresenter.back();
    }
}
